Feedback-directed optimization (FDO) is a technique used to tune application executions based on application runtime behavior in order to improve performance. FDO is also known as Profile Guided Optimization (PGO) and Profile Based Optimization (PBO). In order to tune applications, FDO conducts profiling on the applications. Profiling is the process of gathering information about how an application behaves during runtime. This profile information is used to drive decisions regarding various application optimizations.
As illustrated in FIG. 1, customary feedback-directed optimization is a dual build model technique that uses static instrumentation to collect edge and value profiles. An instrumentation build (101) allows the compiler to insert code into an application's binary to create an instrumented version of the binary (102). This inserted code typically counts edges or collects value profiles. The instrumented binary (102) is run on a representative set of training data (104) in a training run (103). At the end of the training execution, all collected edge counts and value information are written and aggregated in a profile database or gcov data file (GCDA) (105). An optimization build (106) then occurs in which the compiler uses the generated profile to make optimization decisions such as inline decisions, instruction scheduling, basic block re-ordering, function splitting, and register allocation.
AutoFDO is an improvement over traditional FDO because AutoFDO does not require compiling and load testing an instrumented version of an application. Instead, AutoFDO measures an optimized version of the application using hardware performance monitors to obtain a profile of runtime behavior. Automated Feedback-directed optimization, AutoFDO, uses sampling based profiling in order to tune applications.
While AutoFDO is simpler to use than FDO, AutoFDO still requires compiling a binary, running a load test to generate profiles, and recompiling the binary using the generated profile data. Regardless of whether FDO or AutoFDO is performed, collecting profile information is very tedious. As recognized by the inventors, there should be an easier, shorter process for guiding compiler optimization in order to improve application runtime behavior.